public class Pilha {
	private No top;
	
	public Pilha (){
		this.top = null;
	}
	
	public Pilha (String element){
		this.top = new No(element);
	}
	
	public void setTop (No top){
		this.top = top;
	}
	
	public No getTop(){
		return this.top;
	}
	
	public void push (String element){
		No tmp = new No(element);
		tmp.setNext(getTop());
		setTop(tmp);
	}
	
	public String pop (){
		if (!isEmpty()){
			String result = getTop().getElement();
			setTop(getTop().getNext());
			return result;
		}
		return null;
	}
	
	public String top (){
		if (!isEmpty()){
			return getTop().getElement();		
		}
		return null;
	}
	
	public boolean isEmpty(){
		if (getTop() == null && getTop().getElement() == null)
			return true;
		return false;
	}
}